home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM Gold
/
Light ROM Gold.iso
/
arexx
/
measure.lwm
< prev
next >
Wrap
Text File
|
1995-09-04
|
1KB
|
56 lines
/* CMD:Measure */
/*---------------------------
Measure the distance between 2 selected points
-------------------------------------------- */
/* To use: Select 2 points. Run macro */
/* Requires rexxmathlib.library */
signal on error
signal on syntax
call addlib( "LWModelerARexx.port", 0 )
MATHLIB="rexxmathlib.library"
IF POS(MATHLIB , SHOW('L')) = 0 THEN
IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
call notify(1,"!Can't find "MATHLIB)
exit
END
totalpoints = xfrm_begin()
call xfrm_end()
call sel_mode( USER )
n = xfrm_begin()
if n = 0 then do
call notify( 1, "!There are no points in this layer!" )
exit
end
if n = 1 then do
call notify(1, "!You have only selected 1 point. Select 2 points.")
exit
end
if n > 2 then do
if n = totalpoints then do
call notify(1, "!You have either selected all or no points. Please select 2.")
exit
end
call notify(1, "!You have selected more than 2 points. Try again!")
exit
end
p = xfrm_getpos( 1 )
q = xfrm_getpos(2)
call xfrm_end()
parse var p x1 y1 z1
parse var q x2 y2 z2
dx = x2 - x1
dy = y2 - y1
dz = z2 - z1
distance = sqrt(dx**2 + dy**2 + dz**2)
call notify(1,"!Distance ="||distance)
exit
syntax:
error:
call end_all()
call notify( 1, "!Rexx Script Error", "@"errortext( rc ), "Line "sigl )
exit